cmake_minimum_required(VERSION 3.0)

# set project name from current directory
project(AstraCamera)

set (CMAKE_CXX_STANDARD 11)
set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS "-Wall")

find_package( OpenCV REQUIRED)


######################## Third_party ########################
# Third_party include
include_directories(
    ${CMAKE_SOURCE_DIR}/third_party/OpenNI2/x86_64/Include
    ${CMAKE_SOURCE_DIR}/third_party/v4l2/inc
)
# Third_party src
aux_source_directory(${CMAKE_SOURCE_DIR}/third_party/v4l2/src DIR_SRCS)

# Third_party libs
link_directories(
    ${CMAKE_SOURCE_DIR}/third_party/OpenNI2/x86_64/
    /usr/local/lib/
)


# define executable to build
include_directories(
    ${CMAKE_SOURCE_DIR}
    ${CMAKE_SOURCE_DIR}/src/
    ${CMAKE_SOURCE_DIR}/src/camera/
    ${OpenCV_INCLUDE_DIRS}
)

aux_source_directory(${CMAKE_SOURCE_DIR}/src DIR_SRCS)
aux_source_directory(${CMAKE_SOURCE_DIR}/src/camera DIR_SRCS)


# 把项目名和源文件名填上
set(TARGET "AstraCamera")
add_executable(${TARGET} ${DIR_SRCS})

target_link_libraries(
    ${TARGET}
    opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs opencv_videoio opencv_video tbb pthread
    OpenNI2
)